<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="author" content="order by dede58.com"/>
    <title>修改个人信息</title>
    <link rel="stylesheet" type="text/css" href="../css/login.css">

</head>
<body>

    <div class="regist">
        <div class="regist_center">
            <div class="regist_top">
                <div class="left fl">个人信息修改</div>
                <div class="right fr"><a href="./index.html" target="_self">校园商城</a></div>
                <div class="clear"></div>
                <div class="xian center"></div>
            </div>

            <div class="regist_main center">
                <div class="username">用&nbsp;&nbsp;户&nbsp;&nbsp;名:&nbsp;&nbsp;<input id="userName" class="shurukuang"
                                                                                     type="text" name="username"
                                                                                     placeholder="请输入你的用户名"/><span>请不要输入汉字</span>
                </div>
                <div class="username">电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话:&nbsp;&nbsp;<input
                        id="telphone" class="shurukuang" type="text" name="username" placeholder="请输入你的电话号码"/><span>请不要输入汉字</span>
                </div>
                <div class="username">签&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名:&nbsp;&nbsp;<input
                        id="sign" class="shurukuang" type="text" name="password"
                        placeholder="输入签名"/><span></span></div>
                <div class="username">Q&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Q:&nbsp;&nbsp;<input
                        id="qq" class="shurukuang" type="text" name="password"
                        placeholder="输入新qq"/><span></span></div>



            </div>
            <div class="regist_submit">
                <input class="submit" onclick="register()" type="submit" name="submit" value="确认修改">
            </div>

        </div>
    </div>

</body>
<script src="js/crabapple.js" type="text/javascript"></script>
<script>
    function register() {
        let userName = document.getElementById('userName').value
        let telphone = document.getElementById('telphone').value
        let sign = document.getElementById('sign').value
        let qq=document.getElementById('qq').value

        let xmlhttpregister = new XMLHttpRequest();
        xmlhttpregister.onreadystatechange = function () {
            if (xmlhttpregister.readyState == 4 && xmlhttpregister.status == 200) {
                let re = JSON.parse(xmlhttpregister.responseText);
                console.log(re)
                if (re.success == true) {
                    alert("信息修改成功!")
                    window.location.href = '../index.html';
                }
                else alert(re.errMsg)
            }
        }
            xmlhttpregister.open("GET", prime_url + 'user/updateuserpageinfo?' + 'userName=' + userName + '&telephone=' + telphone + '&introduceMyself=' + sign+
                "&qq="+qq+"&userId"+getCookie('userId'), true);
            xmlhttpregister.setRequestHeader('Content-Type', 'application/json')
            xmlhttpregister.send();
    }
</script>
</html>